/*
 * Copyright (c) 2021. Moses All Right Reserved
 */

package com.moses.design_patterns.decorator;

/**
 * @author Moses
 * @email shenhuohui@gmail.com
 * @date 2021/4/17 8:58
 */
public class Client {
    public static void main(String[] args) {

        Component component = new ConcreteComponent();
        Component decorator1 = new ConcreteDecorator1(component);
        decorator1.component();

        System.out.println("====================");
        // 可以很快的切换不同是装饰器进行装饰
        Component decorator2 = new ConcreteDecorator2(component);
        decorator2.component();

        // 跟代理模式差不多
        // 装饰器模式加多了一层装饰抽象类，再由子类实现装饰
        // 而代理类直接与需要装饰的类同级，中间没有添加

    }
}
